
<div class="poll">
    <form method="post" action="main/vote">
        <h3>Poll: <?=$post->topic ?></h3>
        <? if(!$post->voted): ?>
            <ul>
            <? foreach($post->options as $option): ?>
                 <li><input type="radio" name="option_id" value="<?= $option->id; ?>"/><?= $option->answer; ?></li>
            <? endforeach; ?>
            </ul>
            <input type="submit" value="Vote" class="submit"/>
        <? else: ?>
            <ul>
            <? foreach($post->options as $option): ?>
                 <li><?= $option->answer; ?> (<?=$option->vote_count ?> votes)</li>
            <? endforeach; ?>
            </ul>
        <? endif; ?>
    </form>
</div>